import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/system/file/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/system/file/detail',
    method: 'get',
    params: {
      id
    }
  })
}
//删除文件和实体表数据
export const deleteFile = (id) => {
  return request({
    url: '/system/file/delete',
    method: 'post',
    params: {
      id
    }
  })
}
//删除文件和实体表数据
export const remove = (ids) => {
  return request({
    url: '/system/file/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/system/file/submit',
    method: 'post',
    data: row
  })
}
//只更新实体
export const update = (row) => {
  return request({
    url: '/system/file/submit',
    method: 'post',
    data: row
  })
}

export function ossInfo(fileNames,view) {
  return request({
    url: '/system/file/info',
    method: 'get',
    params: { fileNames, view }
  })
}
/**
 * minIo上传文件
 * @param url 请求的url
 * @param data 图片文件
 */
 export function minIoImgUpdate(url, data) {
  return request({
    headers: {
      'Content-Type': data.type
    },
    url: url,
    method: 'put',
    data
  })
}